<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

		<title>员工管理页面</title>
		<link href="../../static/asserts/css/bootstrap.min.css" th:href="@{/asserts/css/bootstrap.min.css}" rel="stylesheet">
		<link href="../../static/asserts/css/dashboard.css" th:href="@{/asserts/css/dashboard.css}" rel="stylesheet">
	</head>

    <body>
    <div th:replace="commons/bar::topbar"></div>

    <div class="container-fluid">
        <div class="row">
            <div th:replace="commons/bar::#sidebar(activeUri='emps')"></div>

            <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
                <h2 >
                    <a class="btn btn-sm btn-success"  href="emp" th:href="@{/emp}">添加员工</a>
                </h2>
                <div class="table-responsive">
                    <table class="table table-striped table-sm">
                        <thead>
                        <tr>
                            <th>员工编号</th>
                            <th>员工姓名</th>
                            <th>员工邮箱</th>
                            <th>员工性别</th>
                            <th>员工所在部门</th>
                            <th>员工生日</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="emp:${emps}">
                            <td th:text="${emp.id}"></td>
                            <td>[[${emp.lastname}]]</td>
                            <td th:text="${emp.email}"></td>
                            <td th:text="${emp.gender}==0?'女':'男'"></td>
                            <td th:text="${emp.department.departmentname}"></td>
                            <td th:text="${#dates.format(emp.birth, 'yyyy-MM-dd')}"></td>
                            <td>
                                <a class="btn btn-sm btn-primary" th:href="@{/emp/}+${emp.id}">编辑</a><br>
                                <form th:action="@{@{/emp/}+${emp.id}}" method="post">
                                    <button type="submit" class="btn btn-sm btn-danger">删除</button>
                                </form>

                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </main>

        </div>
    </div>


    <script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" th:src="@{/webjars/jquery/3.3.1/jquery.js}"></script>
    <script type="text/javascript" src="asserts/js/popper.min.js" th:src="@{/webjars/popper.js/1.11.1/dist/popper.js}"></script>
    <script type="text/javascript" src="asserts/js/bootstrap.min.js" th:src="@{/webjars/bootstrap/4.0.0/js/bootstrap.js}"></script>

    <script type="text/javascript" src="asserts/js/feather.min.js" th:src="@{/asserts/js/feather.min.js}"></script>
    <script>
        feather.replace()
    </script>
    </body>
</html>